<button class="btn btn-success btn-xs" data-toggle="modal" data-target="#incomeCreate">新增</button>

<div class="modal fade" id="incomeCreate" tabindex="-1" role="dialog" aria-labelledby="incomeCreate" aria-hidden="true">
    <div class="modal-dialog modal-xs">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 36px;">&times;</button>
                <h4 class="modal-title" id="myModalLabel">新增</h4>
            </div>
            <div class="modal-body">
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">收款事由</label>
                    <input type="text" name="incomeType" class="form-control" placeholder="请输入收款事由">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">签约客户</label>
                    <select name="contractedCustomerId" class="form-control">
                        <option value="">请选择客户</option>
                        @if(!empty($data))
                            @foreach($data as $key => $value)
                                <option value="{{ $key }}">{{ $value }}</option>
                            @endforeach
                        @endif
                    </select>
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">打款金额</label>
                    <input type="number" name="incomeAmount" class="form-control" placeholder="请输入打款金额">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">到账金额</label>
                    <input type="number" name="actualIncomeAmount" class="form-control" placeholder="请输入到账金额">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">收款日期</label>
                    <input type="date" name="incomeDate" formate="" class="form-control" placeholder="请输入收款日期">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">备注</label>
                    <textarea name="remark" class="form-control" placeholder="请输入备注"></textarea>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" onclick="incomeCreate()">提交</button>
            </div>
        </div>
    </div>
</div>
<script>
    function incomeCreate()
    {
        ajaxPostFunc('/admin/ajax/incomeCreate', {
            income_type: $("input[name='incomeType']").val(),
            contracted_customer_id: $("select[name='contractedCustomerId']").val(),
            income_amount: $("input[name='incomeAmount']").val(),
            actual_income_amount: $("input[name='actualIncomeAmount']").val(),
            income_date: $("input[name='incomeDate']").val(),
            remark: $("textarea[name='remark']").val(),
            _token: $.admin.token
        }, {}, res => {
            console.log(res);
            window.location.reload();
        });
    }
</script>
